#ifndef _GOVT_TRAITS_H
#define	_GOVT_TRAITS_H
/*******************************************************************************
 ** Name: traits.hpp                                                          **
 ** Description: WorldObject-derived container objects                        **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the LICENSE within                  **
 ** this distribution or at $GOVTSANCT_WIKI/License-software.                 **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $HOME/LICENSE.                       **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 **                                                                           **
 ** Copyright (c) 2009-2011  Barry Gian James <gian@gamingods.net>            **
 ** All rights reserved.                                                      **
 ******************************************************************************/
// Portions (c) 2012 Open Design Strategies, LLC.
// Modified $Date: 2011-11-24 00:07:02 -0700 (Thu, 24 Nov 2011) $ by $Author: unknown $
#define traits_h_ID    "$Id: traits.hpp 63608 2011-11-24 07:07:02Z unknown $"

#include <string>
#include "stat.hpp"

#define TRAIT_NONE      0x00000000
// Weapon Traits
// These possibly should be gotten from the DB
#define TRAIT_WPN_AP        1	//!< armor piercing
#define TRAIT_WPN_BAL       2	//!< balanced
#define TRAIT_WPN_DR        3	//!< damage reduction
#define TRAIT_WPN_DEP       4	//!< dependable
#define TRAIT_WPN_DUR       5	//!< durable
#define TRAIT_WPN_ER        6	//!< extended range
#define TRAIT_WPN_FRL       7	//!< fast reload
#define TRAIT_WPN_FLA       8	//!< flamable
#define TRAIT_WPN_FRA       9	//!< frangible
#define TRAIT_WPN_GUI       10	//!< guided
#define TRAIT_WPN_LR        11	//!< long range
#define TRAIT_WPN_NV        12	//!< nigh vision
#define TRAIT_WPN_OBA       13	//!< off balance
#define TRAIT_WPN_REL       14	//!< reliable
#define TRAIT_WPN_SR        15	//!< short range
#define TRAIT_WPN_SRL       16	//!< slow reload
#define TRAIT_WPN_SPL       17
#define TRAIT_WPN_VOL       18
#define TRAIT_WPN_URL       19
#define TRAIT_WPN_UPG       20	//!< upgradable
#define TRAIT_WPN_ACC       21   // accurate
#define TRAIT_WPN_IMP       22   // imprecise
#define TRAIT_WPN_BLK       23   // bulky
#define TRAIT_WPN_DIS       24   // discreet
#define TRAIT_WPN_SUP       25   // suppressed
#define TRAIT_WPN_NSY       26   // noisy
#define TRAIT_WPN_THB       27   // threaded barrel
#define TRAIT_WPN_CMP       28   // composite

// Vehicle Traits
#define TRAIT_VCL_EJS       1    // ejection seats
#define TRAIT_VCL_TRA       2    // traction
#define TRAIT_VCL_SEA       3    // sealed
#define TRAIT_VCL_FLA       4	//<! flammable
#define TRAIT_VCL_DEP       5	//<! dependable
#define TRAIT_VCL_UDE       6
#define TRAIT_VCL_ATV       7    // 4wheeler
#define TRAIT_VCL_ECM       8    // electronic countermeasures
#define TRAIT_VCL_COM       9    // satellite comm system
#define TRAIT_VCL_ARM       10   // armored
#define TRAIT_VCL_FLY       11   // flying
#define TRAIT_VCL_WPN       12   // mounted weapons
#define TRAIT_VCL_UPG		13	 // upgradeable

// Upgrades
#define UPGRADE_WPN_LASER	1	//<! laser sight (incr acc)
#define UPGRADE_WPN_PORT	2	//<! ported to reduce recoil
#define UPGRADE_WPN_THB		3	//<! threaded barrel
#define UPGRADE_WPN_SCOPE	4	//<! give LR attr
#define UPGRADE_WPN_STARLITE 5	//<! give NV attr
#define UPGRADE_WPN_STOCK	6	//<! (acc and reduced recoil w/ BLK attr)
#define UPGRADE_WPN_REFORGE	7	//<! give BAL attr
#define UPGRADE_WPN_POLY	8	//<! give CMP attr
#define UPGRADE_WPN_BURST	9 	//<! give burst capability
#define UPGRADE_WPN_AUTO	10	//<! give full auto capability
#define UPGRADE_WPN_SAWED	11	//<! sawed-off barrel - give SR attr
#define UPGRADE_WPN_SIGHTS	12	//<! give ER attr

//TODO This may replace the defines above
namespace trait 
{
    enum class wpn {
	unknown, ap, bal, dr, dep, dur, er, frl, fla, fra, gui, lr, nv,
	oba, rel, sr, srl, spl, vol, url, upg, acc, imp, blk, dis, sup,
	nsy, thb, cmp
    };

    enum class vehicle {
        none, ejs, tra, sea, fla, dep, ude, atv, ecm,
        com, arm, fly, wpn, upg
    };
}

//! The text/string portion of a Trait.
struct TraitString {
    const char *     name;
    const char *     abbr;
    const int           id;
};

enum class TraitType { Weapon, Vehicle, Equipment, Upgrade, NPC, max };

//! A trait is an adjective describing an item.
class Trait {
public:
	typedef boost::flyweight<Trait> flyweight;
	SMART_PTR_DECL(Trait);

    Trait();
    Trait(std::string d, TraitType, int t);
    ~Trait();

     std::string Desc() const { return desc; }
     uint32       Traits() const { return traits; }

    static std::string TraitToStr(int);
    static std::string TraitToStrAbbr(int);
    
    void         AddStatMod(stats::mod * s) { } //s->next = mods; mods = s; }
    uint32       AddTrait(int t) { BSET(traits,t); return traits; }
    uint32       RemoveTrait(int t) { BCLR(traits,t); return traits; }
    bool	HasTrait(uint32 t) { return(traits & (1<<t)); }


private:
    uint32          traits;     // all traits of object
    TraitType       type;
    std::string    desc;
    stats::mod     mods;       // mods brought by traits

    static TraitString traitStrings[];

};





#endif	/* _OH_TRAITS_H */

